# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=libkcddb
pkgver=23.08.4
pkgrel=0
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://www.kde.org/applications/multimedia/"
pkgdesc="KDE CDDB library"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
makedepends="
	extra-cmake-modules
	kcmutils5-dev
	kcodecs5-dev
	kconfig5-dev
	kdoctools5-dev
	ki18n5-dev
	kio5-dev
	kwidgetsaddons5-dev
	libmusicbrainz-dev
	qt5-qtbase-dev
	samurai
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/multimedia/libkcddb.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkcddb-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
options="net" # Required for tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON
	cmake --build build
}

check() {
	# musicbrainztest-severaldiscs fails due to utf16/8 (?)
	# synchttplookuptest hangs
	# asyncmusicbrainztest http request
	# utf8test seems to fail to start dbus-daemon
	xvfb-run -a ctest --test-dir build --output-on-failure \
		-E "(asyncmusicbrainztest|synchttplookuptest|musicbrainztest-severaldiscs|utf8test)"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
934e1b1ea1ff709cfd088f07a7f443fd33126d382c38aaeed4a37c0f339aceb9fa3b2585e00f3dd96ab731a3e2f43cec8b657605c383daec7cb0a54d86e7d021  libkcddb-23.08.4.tar.xz
"
